<?php
	/*
	 * AJAX call to load the list of publicity messages which will be shown in the future.
	 * Publicity messages are stored in "publicity"
	 *
	 * THIS IS USED ONLY FOR THE FLASH ENVIRONEMENT
	 *
	 * Variables:
	 *   id (int) : Record ID of last already loaded message
	 *
	 * Returns: xml
	 *
	 */

	header('Content-type: text/xml');

	$clean["id"] = round($_GET["id"]);

	// Get a certain ID and higher, excluding the ID
	$smssql = mysql_query("SELECT * FROM publicity WHERE pubFirstdate<NOW() AND pubLoadedAt=\"0000-00-00 00:00:00\" ORDER BY pubID");
	echo '<root>';
	while($row = mysql_fetch_array($smssql, MYSQL_ASSOC)){
		mysql_query("UPDATE publicity SET pubLoadedAt=NOW() WHERE pubID=".$row["pubID"]." LIMIT 1");
		echo "\n".'	<txt id="'.$row["pubID"].'"><![CDATA['.utf8_decode($row["pubText"]).']]></txt>';
	}
	echo "\n".'</root>';

?>